package com.sangmo.fts.teacher.interfaces;

import com.sangmo.boot.framework.common.utils.JsonUtils;
import com.sangmo.boot.framework.plugin.dataview.def.meta.DataField;
import com.sangmo.boot.framework.plugin.dataview.def.meta.DataView;
import com.sangmo.fts.common.IConstants;
import com.sangmo.fts.teacher.model.ScoreSetting;

import java.io.Serializable;
import java.util.List;

@DataView(value = ScoreSetting.class)
public class ScoreSettingCreation implements Serializable {

    private Long userId;

    private int processRatio;

    private int reportRatio;

    private int growthRatio;

    private int durationRatio;

    @DataField(value = IConstants.DATA_TYPE.COLLECTION_4,required = true)
    private List<GrowthRatioSettingCreation> growthRatioSettings;

    @DataField(value = IConstants.DATA_TYPE.COLLECTION_4, required = true)
    private List<DurationRatioSettingCreation> durationRatioSettings;

    public int getProcessRatio() {
        return processRatio;
    }

    public void setProcessRatio(int processRatio) {
        this.processRatio = processRatio;
    }

    public int getReportRatio() {
        return reportRatio;
    }

    public void setReportRatio(int reportRatio) {
        this.reportRatio = reportRatio;
    }

    public int getGrowthRatio() {
        return growthRatio;
    }

    public void setGrowthRatio(int growthRatio) {
        this.growthRatio = growthRatio;
    }

    public int getDurationRatio() {
        return durationRatio;
    }

    public void setDurationRatio(int durationRatio) {
        this.durationRatio = durationRatio;
    }

    public List<DurationRatioSettingCreation> getDurationRatioSettings() {
        return durationRatioSettings;
    }

    public void setDurationRatioSettings(List<DurationRatioSettingCreation> durationRatioSettings) {
        this.durationRatioSettings = durationRatioSettings;
    }

    public List<GrowthRatioSettingCreation> getGrowthRatioSettings() {
        return growthRatioSettings;
    }

    public void setGrowthRatioSettings(List<GrowthRatioSettingCreation> growthRatioSettings) {
        this.growthRatioSettings = growthRatioSettings;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public static ScoreSettingCreation defaultOne() {
        String json = "{\n" +
                "  \"processRatio\": 50,\n" +
                "  \"reportRatio\": 20,\n" +
                "  \"growthRatio\": 20,\n" +
                "  \"durationRatio\": 10,\n" +
                "  \"durationRatioSettings\": [\n" +
                "    {\n" +
                "      \"minValue\":0,\n" +
                "      \"maxValue\": 2,\n" +
                "      \"score\": 100\n" +
                "    },\n" +
                "    {\n" +
                "      \"minValue\":2,\n" +
                "      \"maxValue\": 10,\n" +
                "      \"score\": 90\n" +
                "    },\n" +
                "    {\n" +
                "      \"minValue\":10,\n" +
                "      \"maxValue\": 48,\n" +
                "      \"score\": 70\n" +
                "    },\n" +
                "    {\n" +
                "      \"minValue\":48,\n" +
                "      \"maxValue\": 10000,\n" +
                "      \"score\": 60\n" +
                "    }\n" +
                "  ],\n" +
                "  \"growthRatioSettings\": [\n" +
                "    {\n" +
                "      \"minValue\":20,\n" +
                "      \"maxValue\": 10000,\n" +
                "      \"score\": 100\n" +
                "    },\n" +
                "    {\n" +
                "      \"minValue\":10,\n" +
                "      \"maxValue\": 20,\n" +
                "      \"score\": 90\n" +
                "    },\n" +
                "    {\n" +
                "      \"minValue\":0,\n" +
                "      \"maxValue\": 10,\n" +
                "      \"score\": 70\n" +
                "    },\n" +
                "    {\n" +
                "      \"minValue\":-10000,\n" +
                "      \"maxValue\": 0,\n" +
                "      \"score\": 60\n" +
                "    }\n" +
                "  ]\n" +
                "}";
        return JsonUtils.readValue(json, ScoreSettingCreation.class);
    }
}
